/*
 * triangle.cpp
 *
 *  Created on: Jul 18, 2012
 *      Author: jh238d
 */
#include <iostream>

using namespace std;

#define Scalene 1
#define	Isosceles 2
#define	Equilateral 3
#define	Error 4

int Determine_Triangle_Type(int a, int b, int c)
{	//check valid inputs
	if(a<=0 || b <=0 || c<= 0) return Error;
	//check it satisfies triangle condition
	if(c>=a+b || a>=c+b || b>=a+c) return Error;
	//check if all sides are equal
	if(a==b && b==c)
		return Equilateral;
	else if(a==b || b==c || c==a) //check if any 2 sides are equal
		return Isosceles;
	else
		return Scalene;
}

/*int main(){
	//invalid inputs
	if(Determine_Triangle_Type(0,1,-1) != Error){
		cout << "error!" << endl;
	}
	//not a triangle
	if(Determine_Triangle_Type(1,1,2) != Error){
		cout << "error!" << endl;
	}
	//Equilateral
	if(Determine_Triangle_Type(3,3,3) != Equilateral){
		cout << "error!" << endl;
	}
	//not a triangle
	if(Determine_Triangle_Type(2,3,3) != Isosceles){
		cout << "error!" << endl;
	}
	//Scalene
	if(Determine_Triangle_Type(5,4,3) != Scalene){
		cout << "error!" << endl;
	}
}*/

